#!/bin/sh
echo "当前的路径为:"
pwd
echo "更新现网问题前的备份..."

today=`date +%Y%m%d%H%M%S`

cd /data/tomcat/tomcat_1/webapps
tar czvf tomcat_1_$today.tar.gz ROOT/*
if [ $? -eq 0 ];then
echo "===tomcat_1==备份成功"
else
echo "===tomcat_1==备份失败"
fi

cd /data/tomcat/tomcat_2/webapps
tar czvf tomcat_2_$today.tar.gz ROOT/*
if [ $? -eq 0 ];then
echo "===tomcat_2==备份成功"
else
echo "===tomcat_2==备份失败"
fi

cd /data/tomcat/tomcat_3/webapps
tar czvf tomcat_3_$today.tar.gz ROOT/*
if [ $? -eq 0 ];then
echo "===tomcat_3==备份成功"
else
echo "===tomcat_3==备份失败"
fi

cd /data/tomcat/tomcat_4/webapps
tar czvf tomcat_4_$today.tar.gz ROOT/*
if [ $? -eq 0 ];then
echo "===tomcat_4==备份成功"
else
echo "===tomcat_4==备份失败"
fi

cd /data/tomcat/tomcat_5/webapps
tar czvf tomcat_5_$today.tar.gz ROOT/*
if [ $? -eq 0 ];then
echo "===tomcat_5==备份成功"
else
echo "===tomcat_5==备份失败"
fi

cd /data/tomcat/tomcat_6/webapps
tar czvf tomcat_6_$today.tar.gz ROOT/*
if [ $? -eq 0 ];then
echo "===tomcat_6==备份成功"
else
echo "===tomcat_6==备份失败"
fi